/******************************************************************************
* This file is part of is32p218 platform,
* Copyright (c) 2009 HangZhou InfoStrong CO.,LTD. All rights reserved.
* This software may only be used under the terms of a valid, current,
* end user license from InfoStrong.
* Nothing else gives you the right to use this software.   
*
* Name:   os_sem.h
* Desc:   OS Semphore header file
* Author: Jerry
* Date:   2009-10-19
* Note:   
* History:
*
******************************************************************************/
#include "isOS.h"
#include "os_cfg.h"

#ifndef __OS_SEM_H__
#define __OS_SEM_H__

#if (OS_SEM_EN ==1 )

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _OS_SEM
{
   LIST_QUE  wait_queue;
   isOS_S16 count;
   isOS_S16 max_count;
   isOS_U32 id_sem;     //-- ID for verification(is it a semaphore or another object?)
                     // All semaphores have the same id_sem magic number (ver 2.x)
#if OS_SEM_NAME_EN
   isOS_S8 *pname;
#endif
}isOS_SEM;

isOS_S32 isOS_SemCreate(isOS_SEM * sem,isOS_S16 start_value,isOS_S16 max_val,isOS_S8 *pname);
isOS_S32 isOS_SemDelete(isOS_SEM * sem);     //-- v.2.0
isOS_S32 isOS_SemSignal(isOS_SEM * sem);
isOS_S32 isOS_SemAcquire(isOS_SEM * sem,isOS_U32 timeout);

#ifdef __cplusplus
}
#endif

#endif /* #if (OS_SEM_EN ==1 ) End*/
#endif /* __OS_SEM_H__ End */



